import request from './utils/request'

// 获活动信息
export function getTask(id) {
  return request({
    url: '/appApi/queryTask',
    method: 'get',
    params: { taskId: id }
  })
}
// 获取题目信息
export function getQuestion(data) {
  // 获取经纬度信息
  return request({
    url: '/appApi/startTask',
    method: 'post',
    data: data
  })
}
// 获取地区信息
export function getAreaList() {
  return request({
    url: '/appApi/getAreaList',
    method: 'get',
  })
}
// 发送短信验证码
export function sendSms(mobile, mobileCode) {
  const param = {}
  if (mobile) {
    param.mobile = mobile

  }
  if (mobileCode) {
    param.mobileCode = mobileCode
  }

  return request({
    url: '/appApi/sendSms',
    method: 'get',
    params: param
  })
}

// 发送短信验证码
export function sendSms4Awards(params) {
  return request({
    url: '/appApi/sendSms4Awards',
    method: 'get',
    params
  })
}

// 提交短信验证码
export function submitSms4Awards(params) {
  return request({
    url: '/appApi/submitSms4Awards',
    method: 'get',
    params
  })
}

//保存用户信息
export function saveMember(data) {
  return request({
    url: '/appApi/saveMember',
    method: 'post',
    data: data
  })
}


// 用户提交问卷
export function saveUserTaskOption(data) {
  return request({
    url: '/appApi/saveUserTaskOption',
    method: 'post',
    data: data
  })
}

//模拟答题提交
export function saveUserPraticTask(data) {
  return request({
    url: '/appApi/saveUserPraticTask',
    method: 'post',
    data: data
  })
}

// 用户抽奖接口
export function getUserTaskAwards(data) {
  return request({
    url: '/appApi/getUserTaskAwards',
    method: 'post',
    data: data
  })
}

// 用户中奖信息
export function getAwardsInfoByTask(query) {
  return request({
    url: '/appApi/getAwardsInfoByTask',
    method: 'get',
    params: query
  })
}

// 用户中奖信息列表
export function getAwardListByTask(query) {
  return request({
    url: '/appApi/getAwardListByTask',
    method: 'get',
    params: query
  })
}

// app 配置信息
export function getAppSetting(query) {
  return request({
    url: '/appApi/getAppSetting',
    method: 'get',
    params: query
  })
}

// 查会员信息
export function queryMemberInfo(query) {
  return request({
    url: '/appApi/queryMemberInfo',
    method: 'get',
    params: query
  })
}

// 单独获取答案的接口
export function getAnswerByQuestionId(query) {
  return request({
    url: '/appApi/getAnswerByQuestionId',
    method: 'get',
    params: query
  })
}

//获取服务器时间
export function getCurrentDate(query) {
  return request({
    url: '/appApi/getCurrentDate',
    method: 'get',
    params: query
  })
}

//获取抽奖短信验证码 新实现
export function sendSms4Gain(params) {
  return request({
    url: '/appApi/sendSms4Gain',
    method: 'get',
    params
  })
}

// 提交抽奖 新实现
export function submitSms4Gain(params) {
  return request({
    url: '/appApi/submitSms4Gain',
    method: 'get',
    params
  })
}

//直接请求领奖
export function submitAwards(params) {
  return request({
    url: '/appApi/submitAwards',
    method: 'get',
    params
  })
}